home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 22 / PCPP #22.iso / Quake2 / q2source_12_11 / utils3 / common / cmdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-31  |  2.8 KB  |  124 lines

  1. // cmdlib.h
  2.  
  3. #ifndef __CMDLIB__
  4. #define __CMDLIB__
  5.  
  6. #ifdef _WIN32
  7. #pragma warning(disable : 4244)     // MIPS
  8. #pragma warning(disable : 4136)     // X86
  9. #pragma warning(disable : 4051)     // ALPHA
  10.  
  11. #pragma warning(disable : 4018)     // signed/unsigned mismatch
  12. #pragma warning(disable : 4305)     // truncate from double to float
  13. #endif
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include <errno.h>
  19. #include <ctype.h>
  20. #include <time.h>
  21. #include <stdarg.h>
  22.  
  23. #ifndef __BYTEBOOL__
  24. #define __BYTEBOOL__
  25. typedef enum {false, true} qboolean;
  26. typedef unsigned char byte;
  27. #endif
  28.  
  29. // the dec offsetof macro doesnt work very well...
  30. #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
  31.  
  32.  
  33. // set these before calling CheckParm
  34. extern int myargc;
  35. extern char **myargv;
  36.  
  37. char *strupr (char *in);
  38. char *strlower (char *in);
  39. int Q_strncasecmp (char *s1, char *s2, int n);
  40. int Q_strcasecmp (char *s1, char *s2);
  41. void Q_getwd (char *out);
  42.  
  43. int Q_filelength (FILE *f);
  44. int    FileTime (char *path);
  45.  
  46. void    Q_mkdir (char *path);
  47.  
  48. extern    char        qdir[1024];
  49. extern    char        gamedir[1024];
  50. void SetQdirFromPath (char *path);
  51. char *ExpandArg (char *path);    // from cmd line
  52. char *ExpandPath (char *path);    // from scripts
  53. char *ExpandPathAndArchive (char *path);
  54.  
  55.  
  56. double I_FloatTime (void);
  57.  
  58. void    Error (char *error, ...);
  59. int        CheckParm (char *check);
  60.  
  61. FILE    *SafeOpenWrite (char *filename);
  62. FILE    *SafeOpenRead (char *filename);
  63. void    SafeRead (FILE *f, void *buffer, int count);
  64. void    SafeWrite (FILE *f, void *buffer, int count);
  65.  
  66. int        LoadFile (char *filename, void **bufferptr);
  67. int        TryLoadFile (char *filename, void **bufferptr);
  68. void    SaveFile (char *filename, void *buffer, int count);
  69. qboolean    FileExists (char *filename);
  70.  
  71. void     DefaultExtension (char *path, char *extension);
  72. void     DefaultPath (char *path, char *basepath);
  73. void     StripFilename (char *path);
  74. void     StripExtension (char *path);
  75.  
  76. void     ExtractFilePath (char *path, char *dest);
  77. void     ExtractFileBase (char *path, char *dest);
  78. void    ExtractFileExtension (char *path, char *dest);
  79.  
  80. int     ParseNum (char *str);
  81.  
  82. short    BigShort (short l);
  83. short    LittleShort (short l);
  84. int        BigLong (int l);
  85. int        LittleLong (int l);
  86. float    BigFloat (float l);
  87. float    LittleFloat (float l);
  88.  
  89.  
  90. char *COM_Parse (char *data);
  91.  
  92. extern    char        com_token[1024];
  93. extern    qboolean    com_eof;
  94.  
  95. char *copystring(char *s);
  96.  
  97.  
  98. void CRC_Init(unsigned short *crcvalue);
  99. void CRC_ProcessByte(unsigned short *crcvalue, byte data);
  100. unsigned short CRC_Value(unsigned short crcvalue);
  101.  
  102. void    CreatePath (char *path);
  103. void    QCopyFile (char *from, char *to);
  104.  
  105. extern    qboolean        archive;
  106. extern    char            archivedir[1024];
  107.  
  108.  
  109. extern    qboolean verbose;
  110. void qprintf (char *format, ...);
  111.  
  112. void ExpandWildcards (int *argc, char ***argv);
  113.  
  114.  
  115. // for compression routines
  116. typedef struct
  117. {
  118.     byte    *data;
  119.     int        count;
  120. } cblock_t;
  121.  
  122.  
  123. #endif
  124.